/*
 * @Author: your name
 * @Date: 2020-06-05 10:39:12
 * @LastEditTime: 2020-06-17 14:57:39
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \IM_Web\im_web\src\http.js
 */
import { get, post, deletes, put } from './axios.js'
// const http = 'http://47.105.207.235/v1' http://pc.hdyhlz.com
// const http = '/v1'
const api2 = '/v2'
// const http = 'http://pc.hdyhlz.com/v1'
// const http2 = 'http://pc.hdyhlz.com/v2'
// const http = 'http://192.168.31.118:8899/v1'
// const http2 = 'http://192.168.31.118:8899/v2'
// const http = 'http://cs.zgmjzw.com/v7' // 测试地址
const myregMobile = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9]|16[0-9])[0-9]{8}$/

// 加密
const getRSACode = (params) => {
    return get(`${api2}/common/rsaEncrypt`, { sign: params })
}

// 解密
const getRsaDecrypt = (params) => {
    return get(`${api2}/common/rsaDecrypt`, { sign: params })
}

/**
 * 登录
 */
const webLogin = (params) => {
    // eslint-disable-next-line no-undef
    return post(`${api2}/member/login`, params)
    // return post(`${api2}/member/login`, { secret: params })
}


// 退出登录
const remberOut = params => {
    return post(`${api2}/member/logout`, params)
}

/**
 * 获取短信验证码
 */
const getVerify = params => {
    return get(`${api2}/common/verify`, params)
}

/**
 * 重置密码
 */
const resetpwd = params => {
    return post(`${api2}/member/resetpwd`, params)
}

/**
 * 获取同事列表
 */
const colleagues = params => {
    return get(`${api2}/member/colleagues`, params)
}

/**
 * 获取用户企业列表
 */
const enterprises = params => {
    return get(`${api2}/enterprises/list`, params)
}

/** 
 * 获取企业成员
*/
const enterprisesMember = params => {
    return get(`${api2}/enterprises/memberlist`, params)
}

/**
 * 绑定企业
 */
const enterprisesBind = params => {
    return get(`${api2}/enterprises/bind`, params)
}

/** 
 * 处理加入企业邀请
*/
const companyHandle = params => {
    return post(`${api2}/enterprises/handle`,params)
}

/** 
 * 企业认证
*/
const  companyAttest = params => {
    return post(`${api2}/enterprises/authentication`,params)
}

/** 
 * 企业认证详情
*/
const  companyAuthDetail = params => {
    return post(`${api2}/enterprises/authdetail`,params)
}

/** 
 * 获取其他用户信息
*/
const  otherMemberInfo = params => {
    return get(`${api2}/member/card`,params)
}
export default {
    api2,
    get, post, deletes, put,
    getRSACode,
    getRsaDecrypt,
    webLogin,
    myregMobile,
    getVerify,
    resetpwd,
    colleagues,
    enterprises,
    enterprisesBind,
    remberOut,
    companyHandle,
    companyAttest,
    otherMemberInfo,
    companyAuthDetail,
    enterprisesMember
}
